package com.product.controller;

import com.product.service.ProductService;
import com.product.util.CommonResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/product")
@CrossOrigin
public class ProductController {
    @Autowired
    private ProductService productService;

    @GetMapping("/list")
    public CommonResponse list(){
        return productService.list();
    }

    @GetMapping("/search")
    public CommonResponse search(@RequestParam(value = "target")String target){
        return productService.search(target);
    }
}
